package gob.inei.enaho.view.enaho01;

import java.sql.SQLException;

import gob.inei.enaho2014.R;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import util.form.respuesta.RegistroImpl;
import gob.inei.enaho.controller.activity.HomeActivity;
import gob.inei.enaho.model.dao.mapping.TablaHogar;

public class HogarFinFragment 
extends AbstractHogarFragment {
		
		
	@Override
	protected void procesarOnCreateViewDefault(ViewGroup viewGroup, Button btn) throws Exception {
		
		btn.setText(this.getResources().getString(R.string.iniciar_entrevista));
		
		btn.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {					
				RegistroImpl r = new RegistroImpl();
				r.agregar(TablaHogar.COMPLETO, "1");
				try {
					//ena01Cap100Service.guardar_actualizar(hogar, r);
					hogarService.guardar_actualizar(hogar, r);
				} catch (SQLException e) {
					getCuestionarioContext().manejarExcepcion(e);
				}
				
				AperturaViviendaFragmentAdapter.onResumeSalir = true;
				HomeActivity.onResumeHogarParaAbrir = hogar;
				salir();
			}
		});
	}
	
}